package br.com.caelum.tarefas.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import br.com.caelum.tarefas.modelo.Tarefa;
import br.com.caelum.tarefas.modelo.TarefaDAO;

@Controller
public class TarefasController {
	
	@RequestMapping("/novaTarefa")
	public String form() {
		return "tarefa/formulario";
	}
	
	@RequestMapping("/adicionaTarefa")
	public String adiciona(Tarefa tarefa) {
		
		try {
			TarefaDAO dao;
			dao = new TarefaDAO();
			dao.adiciona(tarefa);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "tarefa/adicionada";
	}


}
